﻿using System;

namespace SuperX.SuperSocket.Common
{
    [Serializable]
    public class UpLoadInfo
    {
        /// <summary>
        /// 上传文件名称
        /// </summary>
        public string FileName { get; set; }

        /// <summary>
        /// 文件大小
        /// </summary>
        public long FileSize { get; set; }

        /// <summary>
        /// 保存名称
        /// </summary>
        public string SaveName { get; set; }

        /// <summary>
        /// 上传开始位置
        /// </summary>
        public long TransferPos { get; set; }

        /// <summary>
        /// 上传文件长度（大小）
        /// </summary>
        public long TransferLength { get; set; }

        public UpLoadInfo(string _FileName, long _FileSize, long _TransferPos = 0L, long _TransferLength = 0L, string _SaveName = "")
        {
            if (string.IsNullOrWhiteSpace(_SaveName))
                _SaveName = System.IO.Path.GetFileName(_FileName);
            if (_TransferLength == 0)
                _TransferLength = _FileSize;
            FileName = _FileName;
            FileSize = _FileSize;
            TransferPos = _TransferPos;
            TransferLength = _TransferLength;
            SaveName = _SaveName;
        }
    }
}